using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace LogParser.DA
{
    public class LeagueModel
    {

        public LeagueModel()
        {

        }


        public static DA.DataObjects.LeaguesDS.LeagueSelectDataTable GetLeagueDataTable()
        {
            DA.DataObjects.LeaguesDSTableAdapters.LeagueSelectTableAdapter lta = TableAdapters.LeagueTableAdapter();

            DA.DataObjects.LeaguesDS.LeagueSelectDataTable dt = lta.GetData();

            return dt;

        }

        public static DA.DataObjects.LeaguesDS.LeagueSelectRow GetLeagueDataRow( int leagueId )
        {
            DA.DataObjects.LeaguesDSTableAdapters.LeagueSelectTableAdapter lta = TableAdapters.LeagueTableAdapter();

            DA.DataObjects.LeaguesDS.LeagueSelectRow dr = ( ( DA.DataObjects.LeaguesDS.LeagueSelectRow ) lta.LeagueSelectByLeagueId( leagueId ).Rows[ 0 ] );

            return dr;

        }


        public static bool DeleteLeague( int leagueId )
        {
            DA.DataObjects.LeaguesDSTableAdapters.LeagueSelectTableAdapter lta = TableAdapters.LeagueTableAdapter();

            bool result = false;

            try
            {
                int deleteResult = lta.LeagueDeleteLeagueId( leagueId );
                result = true;
            }
            catch
            {
                result = false;
            }

            return result;
        }


    }
}
